import { ThemeContext } from '../../context';

class NavItem extends React.Component {
  render() {
    //接收父组件传递的item ,index
    const { item, index } = this.props;

    return (
      <ThemeContext.Consumer>
        {(theme) => (
          <div className={!index ? `item active-${theme}` : 'item'}>{item}</div>
        )}
      </ThemeContext.Consumer>
    );
  }
}

export default NavItem;
